home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH6 / SRC / AALIAS3.BAS < prev    next >
BASIC Source File  |  1997-01-08  |  4KB  |  63 lines

  1. Attribute VB_Name = "AntiAlias"
  2. Option Explicit
  3.  
  4. Type PALETTEENTRY
  5.     peRed As Byte
  6.     peGreen As Byte
  7.     peBlue As Byte
  8.     peFlags As Byte
  9. End Type
  10. Public Const PC_EXPLICIT = &H2      ' Match to system palette index.
  11. Public Const PC_NOCOLLAPSE = &H4    ' Do not match color existing entries.
  12.  
  13. ' GetDeviceCaps constants.
  14. Global Const RASTERCAPS = 38    ' Raster device capabilities.
  15. Global Const RC_PALETTE = &H100 ' Has palettes.
  16. Global Const NUMRESERVED = 106  ' # reserved entries in palette.
  17. Global Const SIZEPALETTE = 104  ' Size of system palette.
  18.  
  19. #If Win32 Then  ' 32-bit VB.
  20.     Type BITMAP ' 24 bytes
  21.         bmType As Long
  22.         bmWidth As Long
  23.         bmHeight As Long
  24.         bmWidthBytes As Long
  25.         bmPlanes As Integer
  26.         bmBitsPixel As Integer
  27.         bmBits As Long
  28.     End Type
  29.     Global Const BITMAP_SIZE = 24
  30.     Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  31.     Declare Function ResizePalette Lib "gdi32" (ByVal hPalette As Integer, ByVal nNumEntries As Integer) As Integer
  32.     Declare Function SetPaletteEntries Lib "gdi32" (ByVal hPalette As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  33.     Declare Function GetPaletteEntries Lib "gdi32" (ByVal hPalette As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  34.     Declare Function GetSystemPaletteEntries Lib "gdi32" (ByVal hdc As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  35.     Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long
  36.     Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  37.     Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  38.     Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  39.     Declare Function GetNearestPaletteIndex Lib "gdi32" (ByVal hPalette As Integer, ByVal crColor As Long) As Integer
  40. #Else           ' 16-bit VB.
  41.     Type BITMAP ' 14 bytes
  42.         bmType As Integer
  43.         bmWidth As Integer
  44.         bmHeight As Integer
  45.         bmWidthBytes As Integer
  46.         bmPlanes As String * 1
  47.         bmBitsPixel As String * 1
  48.         bmBits As Long
  49.     End Type
  50.     Global Const BITMAP_SIZE = 14
  51.     Declare Function GetDeviceCaps Lib "GDI" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  52.     Declare Function ResizePalette Lib "GDI" (ByVal hPalette As Integer, ByVal nNumEntries As Integer) As Integer
  53.     Declare Function SetPaletteEntries Lib "GDI" (ByVal hPalette As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  54.     Declare Function GetPaletteEntries Lib "GDI" (ByVal hPalette As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  55.     Declare Function GetSystemPaletteEntries Lib "GDI" (ByVal hdc As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  56.     Declare Function RealizePalette Lib "User" (ByVal hdc As Integer) As Integer
  57.     Declare Function GetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  58.     Declare Function SetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  59.     Declare Function GetObject Lib "GDI" (ByVal hObject As Integer, ByVal nCount As Integer, lpObject As Any) As Integer
  60.     Declare Function GetNearestPaletteIndex Lib "GDI" (ByVal hPalette As Integer, ByVal crColor As Long) As Integer
  61. #End If
  62.  
  63.